import { Pagination as AntdPagination } from 'antd'

import './index.scss'

interface PaginationProps {
  current: number // 当前页码
  total: number // 总条数
  handleChange: (parameter: number) => void
}
const Pagination = (props: PaginationProps) => {
  const pageChange = (pageIndex: number) => {
    props.handleChange(pageIndex)
  }
  return (
    <div className="pagination-box">
      <AntdPagination
        current={props.current}
        total={props.total}
        showTotal={total => `共 ${total} 条`}
        showSizeChanger={false}
        onChange={pageChange}
      />
    </div>
  )
}

export default Pagination
